package com.cxh.rmsq.viewmodel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;

import com.cxh.rmsq.db.model.BaseResultCommentListBean;
import com.cxh.rmsq.db.model.BaseResultListBean;
import com.cxh.rmsq.db.model.CommunityContent;
import com.cxh.rmsq.model.Result2;
import com.cxh.rmsq.task.SocialCircleTask;
import com.cxh.rmsq.utils.SingleSourceLiveData;

import okhttp3.RequestBody;

public class SocialCircleViewModel extends AndroidViewModel {

    SocialCircleTask securityTask;

    private SingleSourceLiveData<Result2<CommunityContent>> securityVerify3 =
            new SingleSourceLiveData<>();
    private SingleSourceLiveData<Result2<CommunityContent>> securityVerifyinfo =
            new SingleSourceLiveData<>();
    private SingleSourceLiveData<Result2<String>> securityVerify =
            new SingleSourceLiveData<>();

    private SingleSourceLiveData<Result2<String>> securityVerifyDel =
            new SingleSourceLiveData<>();
    private SingleSourceLiveData<Result2<BaseResultListBean>> securityVerify2 =
            new SingleSourceLiveData<>();
    private SingleSourceLiveData<Result2<BaseResultListBean>> securityVerify22 =
            new SingleSourceLiveData<>();
    private SingleSourceLiveData<Result2<BaseResultCommentListBean>> securityVerifyComment =
            new SingleSourceLiveData<>();

    public SocialCircleViewModel(@NonNull Application application) {
        super(application);
        securityTask = new SocialCircleTask(application);

//        securityStatus.setSource(securityTask.querySecurityStatus());
    }

    public LiveData<Result2<BaseResultListBean>> getToUserCommunityContentPage() {
        return securityVerify2;
    }




    public LiveData<Result2<String>> createCommunity() {
        return securityVerify;
    }


    public void getToUserCommunityContentPage(String userId, String toUserId, int pageNo, int pageSize) {
        securityVerify2.setSource(securityTask.getToUserCommunityContentPage(userId, toUserId, pageNo, pageSize));
    }


    public LiveData<Result2<BaseResultListBean>> getCommunityPage() {
        return securityVerify2;
    }

    public void getCommunityPage(String userId, String toUserId, int pageNo, int pageSize) {
        securityVerify2.setSource(securityTask.getCommunityPage(userId, toUserId, pageNo, pageSize));
    }

    public LiveData<Result2<BaseResultListBean>> getSubscriberCommunityPage() {
        return securityVerify22;
    }

    public void getSubscriberCommunityPage(String userId, String toUserId, int pageNo, int pageSize) {
        securityVerify22.setSource(securityTask.getSubscriberCommunityPage(userId, toUserId, pageNo, pageSize));
    }



    public LiveData<Result2<BaseResultListBean>> getCircleCommunityPage() {
        return securityVerify2;
    }

    public void getCircleCommunityPage(String userId, String circleId, int pageNo, int pageSize) {
        securityVerify2.setSource(securityTask.getCircleCommunityPage(userId, circleId, pageNo, pageSize));
    }



    public LiveData<Result2<String>> commentLiked() {
        return securityVerify;
    }

    public void commentLiked(RequestBody body) {
        securityVerify.setSource(securityTask.commentLiked(body));
    }



    public LiveData<Result2<CommunityContent>> getCommunityInfo() {
        return securityVerifyinfo;
    }

    public void getCommunityInfo(String id, String viewerId) {
        securityVerifyinfo.setSource(securityTask.getCommunityInfo(id, viewerId));
    }



    public LiveData<Result2<BaseResultCommentListBean>> getCommentList() {
        return securityVerifyComment;
    }

    public void getCommentList(String contentId, int pageNo, int pageSize) {
        securityVerifyComment.setSource(securityTask.getCommentList(contentId, pageNo, pageSize));
    }



    public LiveData<Result2<String>> delComment() {
        return securityVerifyDel;
    }

    public void delComment(String id) {
        securityVerifyDel.setSource(securityTask.DelComment(id));
    }



    public LiveData<Result2<CommunityContent>> createComment() {
        return securityVerify3;
    }

    public void createComment(RequestBody body) {
        securityVerify3.setSource(securityTask.CreateComment(body));
    }


    public void createCommunity(RequestBody body) {
        securityVerify.setSource(securityTask.CreateCommunity(body));
    }

}
